// packageE/appointment/components/addGoodCell/addGoodCell.js
const app = getApp();
Component({

  /**
   * 组件的属性列表
   */
  properties: {
    required: {
      type: Boolean,
      value: false
    },
    label: {
      type: String,
      value: ""
    },
    contenType: {
      type: String,
      value: "inp"
    },
    linkConten: {
      type: null,
      value: ""
    },
    partition: {
      type: Boolean,
      value: false
    },
    placeholderTxt: {
      type: String,
      value: "请输入"
    },
    checkedPost: {
      type: Boolean,
      value: false
    },
    inpval: {
      type: String,
    },
    blackC_is: {
      type: Boolean,
      value: false
    },
    projectList: {
      type: Array
    },
    goods:{
      type:null
    }
  },
  observers: {
    linkConten(str) {
      console.log(str)
    }
  },
  /**
   * 组件的初始数据
   */
  data: {},

  /**
   * 组件的方法列表
   */
  methods: {
    switchTap(e) {
      this.triggerEvent("switchTap", e.detail)
    },
    bindinp(e) {
      // console.log(e)
      this.triggerEvent("inp", e.detail.value)
    },
    clickLink(e) {
      this.triggerEvent("tapLink")
    },
    del(e) {
      console.log(e)
    },
    onRead(event) {
      const {
        file
      } = event.detail;
      let urlStr = app.getNetAddresss("upload.uploadPic");
      // 当设置 mutiple 为 true 时, file 为数组格式，否则为对象格式
      wx.uploadFile({
        url: urlStr,
        filePath: file.url,
        name: 'file',
        success: (resdata) => {
          let {
            result,
            msg,
            data
          } = JSON.parse(resdata.data);
          if (result) {
            this.triggerEvent("uploadImg", data.img_url)
          };
        }
      });
    }
  }
})